﻿
Partial Public Class WebForm_ManageMeeting
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Me.SearchOption1.BindData(Me.Division, Me.ViewPoint)
        End If
        TCReport1.ProgramID = Me.GetProramData("ManageSalesForecastV2").Split(",")(0)
        TCReport1.ProgramParent = Me.GetProramData("ManageSalesForecastV2").Split(",")(1)
        SFReport1.ProgramID = Me.GetProramData("ManageFinanceForecast").Split(",")(0)
        SFReport1.ProgramParent = Me.GetProramData("ManageFinanceForecast").Split(",")(1)
    End Sub

    Protected Sub SearchOption1_Submit(ByVal sender As Object, ByVal e As System.EventArgs) Handles SearchOption1.Submit
        SearchOption1.CopyTo(TCReport1.SearchOption)
        TCReport1.SearchOption.OnSubmit(EventArgs.Empty)
        'TCReport1.BindData()

        SearchOption1.CopyTo(SFReport1.SearchOption)
        SFReport1.SearchOption.OnSubmit(EventArgs.Empty)
        'SFReport1.BindData()
    End Sub
    Private Function GetProramData(ByVal ProramString As String) As String
        Dim sql As New MyStringBuilder
        Dim dat As New clsData
        Dim dt As Data.DataTable
        '   ProramString = "ManageSalesForecastV2"
        sql.Length = 0
        sql.AppendFormat("Select ProgramID,Parent  from Program  ")
        sql.AppendFormat("where url  like '%\WebForm\{0}.aspx?Division={1}%' ", ProramString, Division)
        dt = dat.GetData(sql)
        If TypeOf dt.Rows(0)("ProgramID") Is DBNull AndAlso TypeOf dt.Rows(0)("Parent") Is DBNull Then
            Return Nothing
        Else
            Return dt.Rows(0)("ProgramID") & "," & dt.Rows(0)("Parent")
        End If

    End Function
    Public ReadOnly Property Division() As String
        Get
            Return Me.Request.QueryString.Item("Division")
        End Get
    End Property

    Private Property ViewPoint() As String
        Get
            Return "SF"
        End Get
        Set(ByVal value As String)
            ViewState("ViewPoint") = value
        End Set
    End Property

End Class
